<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<input id="btnLoad" type="button" value="加载">
	<div id="divContent"></div>
	<script>
		document.getElementById("btnLoad").onclick = function(){
			//1. 创建XmlHttpRequest对象
			var xmlhttp;
			if(window.XMLHttpRequest){
				xmlhttp = new XMLHttpRequest();
			}else{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			console.log(xmlhttp);
			//2. 发送Ajax请求
			xmlhttp.open("GET" , "/ajax/content" , true);
			xmlhttp.send();
			//3. 处理服务器响应
			xmlhttp.onreadystatechange = function(){
				if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
					var t = xmlhttp.responseText;
					alert(t);
					document.getElementById("divContent").innerHTML = t;
				}
			}
		}
	</script>
</body>
</html>